package com.huanzhidadi.hystrix.feign.consumer.controller;

import com.huanzhidadi.hystrix.feign.consumer.feign.HystrixProviderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class HystrixConsumerController {
    @Resource
    private HystrixProviderService hystrixProviderService;

    @GetMapping("/consumer/payment/ok/{id}")
    public String paymentInfo_OK(@PathVariable("id") Integer id) {
        String result = hystrixProviderService.paymentInfo_OK(id);
        return result;
    }

    @GetMapping("/consumer/payment/timeout/{id}")
    public String paymentInfo_TimeOut(@PathVariable("id") Integer id) {
        String result = hystrixProviderService.paymentInfo_FAIL(id);
        return result;
    }

}
